跳到主要内容

Linux / MacOS安装OhMyZsh

  1. 安装zsh。MacOS Catalina之后的系统默认shell为zsh,可以省略这一步,安装git即可。
apt-get update && apt-get install -y \
    curl \
    git \
    zsh
  1. 安装ohmyzsh。
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
  1. 安装zsh自动提示和语法高亮插件。
mkdir -p ~/.zsh # 根目录创建 .zsh 文件夹,用来存放两个插件
git clone https://github.com/zsh-users/zsh-autosuggestions ~/.zsh/zsh-autosuggestions
git clone https://github.com/zsh-users/zsh-syntax-highlighting ~/.zsh/zsh-syntax-highlighting
  1. 将插件路径导出到 .zshrc 文件中
echo source ~/.zsh/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh >> ~/.zshrc && echo source ~/.zsh/zsh-autosuggestions/zsh-autosuggestions.zsh >> ~/.zshrc
  1. 重新加载 .zshrc 文件
source ~/.zshrc